<template>
  <el-row
    type="flex"
    align="middle"
    justify="space-between"
    style="width: 100%"
  >
    <el-col :span="18">{{ item.name }}</el-col>
    <el-col :span="6">
      <el-row type="flex">
        <el-col>{{ item.manager || '负责人' }}</el-col>
        <el-col>
          <el-dropdown>
            <span class="el-dropdown-link">
              操作<i class="el-icon-arrow-down el-icon--right" />
            </span>
            <el-dropdown-menu slot="dropdown">
              <el-dropdown-item @click.native="addDepart">添加子部门</el-dropdown-item>
              <el-dropdown-item v-if="isshow" @click.native="editDepart">编辑子部门</el-dropdown-item>
              <el-dropdown-item v-if="isshow" @click.native="delDepart">删除子部门</el-dropdown-item>
            </el-dropdown-menu>
          </el-dropdown>
        </el-col>
      </el-row>
    </el-col>
  </el-row>
</template>

<script>
export default {
  props: {
    item: {
      type: Object,
      default: () => {}
    },
    isshow: {
      type: Boolean,
      default: true
    }
  },
  data() {
    return {
      // isShow:
    }
  },
  methods: {
    // 添加子部门，子传父
    addDepart() {
      this.$emit('dialogShow', this.item)
    },
    // 编辑子部门，子传父
    editDepart() {
      this.$emit('dialogShow', this.item, 'edit')
    },
    // 删除子部门，子传父
    delDepart() {
      this.$emit('delDepart', this.item)
    }
  }
}
</script>

<style>
</style>
